﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IUseCase.cs" company="">
//   
// </copyright>
// <summary>
//   The UseCase interface.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

using System.Runtime.Remoting;
using Libium.Components;

namespace Libium.UseCases
{
    using System;
    using System.Collections.Generic;

    using Libium.Core;
    using Libium.Validation;

    /// <summary>
    ///   The UseCase interface.
    /// </summary>
	public interface IUseCase : IViewBindable, IValidable, ICopySource, IPasteTarget, IStartable, ISuspendable, IActivable
	{
		#region Public Events

		/// <summary>
		///   The empty changed.
		/// </summary>
		event Action<IUseCase> EmptyChanged;

		/// <summary>
		///   The error added.
		/// </summary>
		event Action<IUseCase, IError> ErrorAdded;

		/// <summary>
		///   The error deleted.
		/// </summary>
		event Action<IUseCase, IError> ErrorDeleted;

		/// <summary>
		///   The hint added.
		/// </summary>
		event Action<IUseCase, IHint> HintAdded;

		/// <summary>
		///   The hint deleted.
		/// </summary>
		event Action<IUseCase, IHint> HintDeleted;

		/// <summary>
		///   The modified changed.
		/// </summary>
		event Action<IUseCase> ModifiedChanged;

		/// <summary>
		///   The readonly changed.
		/// </summary>
		event Action<IUseCase> ReadonlyChanged;

		/// <summary>
		///   The wait ended.
		/// </summary>
		event Action<IUseCase> WaitEnded;

		/// <summary>
		///   The wait started.
		/// </summary>
		event Action<IUseCase> WaitStarted;

		/// <summary>
		///   The warning added.
		/// </summary>
		event Action<IUseCase, IWarning> WarningAdded;

		/// <summary>
		///   The warning deleted.
		/// </summary>
		event Action<IUseCase, IWarning> WarningDeleted;

		/// <summary>
		///   The wait porogress changed.
		/// </summary>
		//event Action<IUseCase> WaitProgressChanged;


		#endregion

		#region Public Properties

		/// <summary>
		///   Gets or sets a value indicating whether active.
		/// </summary>
		bool Active { get; set; }

		/// <summary>
		///   Gets the commands.
		/// </summary>
		IEnumerable<ICommand> Commands { get; }

		/// <summary>
		///   Gets or sets the description.
		/// </summary>
		string Description { get; set; }

		/// <summary>
		///   Gets a value indicating whether empty.
		/// </summary>
		bool Empty { get; }

		/// <summary>
		///   Gets the errors.
		/// </summary>
		IEnumerable<IError> Errors { get; }

		/// <summary>
		///   Gets or sets the help uri.
		/// </summary>
		string HelpUri { get; set; }

		/// <summary>
		///   Gets the hints.
		/// </summary>
		IEnumerable<IHint> Hints { get; }

		/// <summary>
		///   Gets a value indicating whether modified.
		/// </summary>
		bool Modified { get; }

		/// <summary>
		///   Gets or sets the name.
		/// </summary>
		string Name { get; set; }

		/// <summary>
		///   Gets the parent.
		/// </summary>
		ICompoundUseCase Parent { get; }

		/// <summary>
		///   Gets or sets a value indicating whether read only.
		/// </summary>
		bool ReadOnly { get; set; }

		/// <summary>
		///   Gets the root.
		/// </summary>
		ICompoundUseCase Root { get; }

		/// <summary>
		///   Gets a value indicating whether waiting.
		/// </summary>
		bool Waiting { get; }

		/// <summary>
		///   Gets the warnings.
		/// </summary>
		IEnumerable<IWarning> Warnings { get; }

		#endregion

		#region Public Methods and Operators

		/// <summary>
		/// The execute command.
		/// </summary>
		/// <param name="call">
		/// The call. 
		/// </param>
		void ExecuteCommand(CommandCall call);

		/// <summary>
		///   The make empty.
		/// </summary>
		void MakeEmpty();

		//void CancelWait();

		#endregion

		void ResetModified();
	}
}